﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using SharePointZip.Tools;
using System.Collections.Generic;
using System.Collections;
using Microsoft.SharePoint.Utilities;
using System.Text;
using System.IO;
using SharePointZip.Base;
using SharePointZip.Controller;

//Copyright (C) Riwut Libinuko, 2010 - Ideas For Free
//http://blog.libinuko.com

namespace SharePointZip.Controls
{
    public partial class Downloader : UserControl , IUserControl<Downloader>
    {
        SPList currentList;
        Guid workGuid;

        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Page.Request.Params["List"] != null)
            //{
            //    currentList = SPContext.Current.List;
            //    workGuid = Guid.NewGuid();

            //    // Working on Item
            //    if (Page.Request.Params["ItemID"] != null)
            //    {
            //        var spListItem = SPContext.Current.ListItem;
            //        var spFileCompress = ServiceLocator.Instance.GetService<ICompress<SPFile>>();
            //        spFileCompress.CreateCompressedStream(spListItem.File);
            //    }
            //    // Working on Item Collection
            //    else
            //    {

            //        var spListItem = SPContext.Current.ListItem;
            //        ICompress<SPListItem> compress = new Utilities<SPListItem>();
            //        compress.CreateCompressedStream(spListItem);
            //    }
            //} 
            //else if (Page.Request.Params["ProcGUID"] != null)
            //{
                
            //}
            //else
            //{
            //    Response.Write("Direct access is not allowed. Please wait for redirection.");
            //    Response.Write("<script language='javascript'>setTimeout(\"window.location='/'\",2000);</script>");
            //    Response.End();
            //}
        }

        private string GetServerFilePath(string p)
        {
            throw new NotImplementedException();
        }

        public string GetUserControlPath
        {
            get {
                return "~/_controltemplates/SharePointZip/Downloader.ascx";
            }
        }
    }
}
